package com.kaishengit.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.ServletActionContext;

import com.kaishengit.pojo.Message;
import com.kaishengit.pojo.Task;
import com.kaishengit.pojo.User;
import com.kaishengit.pojo.UserGroup;
import com.kaishengit.service.MessageService;
import com.kaishengit.service.TaskService;
import com.opensymphony.xwork2.ActionSupport;

public class MessageAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	
	private MessageService messageService;
	private List<Message> messageList;
	private TaskService taskService;
	private List<Task> todayTaskList;
	private List<Task> notCompleteList;
	
	public String execute() {
		Map<String, Object> session = ServletActionContext.getContext().getSession();
		User user = (User) session.get("user");
		UserGroup group = user.getGroup();
		messageList = messageService.findICanSee(user, group);
		todayTaskList = taskService.getTodayTask();
		notCompleteList = taskService.findNotComplete();
		return SUCCESS;
	}

	//get set
	public void setMessageService(MessageService messageService) {
		this.messageService = messageService;
	}

	public MessageService getMessageService() {
		return messageService;
	}

	public void setMessageList(List<Message> messageList) {
		this.messageList = messageList;
	}

	public List<Message> getMessageList() {
		return messageList;
	}

	public void setTaskService(TaskService taskService) {
		this.taskService = taskService;
	}

	public TaskService getTaskService() {
		return taskService;
	}

	public void setTodayTaskList(List<Task> todayTaskList) {
		this.todayTaskList = todayTaskList;
	}

	public List<Task> getTodayTaskList() {
		return todayTaskList;
	}

	public void setNotCompleteList(List<Task> notCompleteList) {
		this.notCompleteList = notCompleteList;
	}

	public List<Task> getNotCompleteList() {
		return notCompleteList;
	}

}
